package com.demo.dlxOne;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @Author: lkz
 * @Title: 测试消息id
 * @Description: TODO
 * @Date: 2023/10/16 14:42
 */
@Component
@Slf4j
public class DlxOneConsumMsg {

    //@RabbitListener(queues = "dlx.one.ttlQueue")
    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue("dlx.one.ttlQueue"),
                    key = "order",
                    exchange = @Exchange(value = "dlx.one.normalExchange"))//默认的直连交换机
    })
    public void msg(String msg, Message message){
        log.info("延迟消息发送私信队列---dlx.one.ttlQueue:{}",msg);
        log.info("延迟消息发送私信队列消息Id---dlx.one.ttlQueue:{}",message.getMessageProperties().getMessageId());
       // message.getMessageProperties().getMessageId();
    }

}
